import type { ColumnType } from './table/types'

export const getHeaderDepth = (columns: ColumnType[]) => {
  let res = 1

  const inner = (cols: ColumnType[], depth: number) => {
    for (const col of cols) {
      if (col.children && col.children.length > 0) {
        inner(col.children, depth + 1)
      } else {
        res = Math.max(res, depth)
      }
    }
  }

  inner(columns, 1)
  return res
}
